/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package main;

/**
 *
 * @author ZSQ
 */

public class Tanh implements ActivationFunction {
    @Override
    public double calculate(double value) {
        return Math.tanh(value);
    }
    
    @Override
    public double derivative(double value) {
        double tanh = calculate(value);
        return 1 - tanh * tanh;
    }
}
